package com.example.Laboratory.Service.Impl;

import com.example.Laboratory.Entity.Backbone;
import com.example.Laboratory.Mapper.BackboneMapper;
import com.example.Laboratory.Service.BackboneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BackboneServiceImpl implements BackboneService {

    @Autowired
    BackboneMapper backboneMapper;

    //添加学科骨干信息
    @Override
    public String addBackbone(Backbone b) {
        if (backboneMapper.addBackbone(b) == 1) {
            return "添加成功";
        } else {
            return "添加失败";
        }
    }

    //根据id删除学科骨干信息
    @Override
    public String deleteBackbone(int backbone_id) {
        if (backboneMapper.deleteBackbone(backbone_id) == 1) {
            return "删除成功";
        } else {
            return "删除失败";
        }
    }

    //查找学科骨干信息
    @Override
    public List<Backbone> researchBackbone() {
        return backboneMapper.researchBackbone();
    }

    //修改信息
    @Override
    public String reviseBackbone(Backbone b) {
        if (backboneMapper.reviseBackbone(b) == 1) {
            return "修改成功";
        } else {
            return "修改失败";
        }
    }
}
